﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace CommonLib
{

	public struct AudioDataBase
	{
		AudioClip clip;
		public AudioClip AudioClip => clip;
		//AssetFile File;
		string name;
		public string Name => name;
		string tag;
		public string Tag => tag;
		AudioPlayMode playMode;
		public AudioPlayMode PlayMode => playMode;
		bool loop;
		public bool Loop => loop;

		float volumePerCent;
		float resourceVolume;
		public float Volume => volumePerCent >= 0 && volumePerCent <= 1 ? volumePerCent * resourceVolume : resourceVolume;

		public AudioDataBase(AudioClip clip, string name, string tag = "", AudioPlayMode playMode =  AudioPlayMode.None, bool loop = false,
			float volumePerCent = 1, float resourceVolume = 1)
		{
			this.clip = clip;
			this.name = name;
			this.tag = tag;
			this.playMode = playMode;
			this.loop = loop;
			this.resourceVolume = volumePerCent;
			this.volumePerCent = resourceVolume;
		}
	}
	public enum AudioPlayMode
	{
		//直接播放
		None = 0,
		//已有同一Label的Clip进行播放时，重新播放
		RePlay = 1,
		//已有同一Label的Clip进行播放时保持不进行播放
		NotPlaySame = 2
	}
}